//
//  CollectionViewCell.m
//  UI18_UICollectionViewCell
//
//  Created by dllo on 16/3/7.
//  Copyright © 2016年 dllo. All rights reserved.
//

#import "CollectionViewCell.h"

@implementation CollectionViewCell
//初始化
- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        self.imgView = [[UIImageView alloc] init];
        _imgView.backgroundColor = [UIColor cyanColor];
        [self.contentView addSubview:_imgView];
        
        self.titleLabel = [[UILabel alloc] init];
        //_titleLabel.backgroundColor = [UIColor greenColor];
        _titleLabel.textAlignment = 1;
        [self.contentView addSubview:_titleLabel];
    }
    return self;
}
//布局方法
-(void)applyLayoutAttributes:(UICollectionViewLayoutAttributes *)layoutAttributes
{
    [super applyLayoutAttributes:layoutAttributes];
    _imgView.frame = CGRectMake(0, 0, layoutAttributes.size.width, layoutAttributes.size.height - 40);
    _titleLabel.frame = CGRectMake(0, layoutAttributes.size.height - 40, _imgView.frame.size.width, 40);
    _imgView.layer.cornerRadius = _imgView.frame.size.width/2;
    _imgView.clipsToBounds = YES;
    
}
@end
